package service.impl;

import dao.StudentDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pojo.Student;
import service.StudentService;

import java.util.List;

//以这个参数命名对象
@Service("studentService")
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentDao studentdao;

    @Override
    public List<Student> findAll( int offset, int pageSize) {
        List<Student> students=studentdao.findAll(offset,pageSize);
        return students;
    }

    @Override
    public int count(Student student) {
        return studentdao.count(student);
    }

    @Override
    public int deleteStudentById(int sid) {
        return studentdao.deleteStudentById(sid);
    }

    @Override
    public int addStudent(Student student) {
        return studentdao.addStudent(student);
    }

    @Override
    public Student findStudentById(int sid) {
        return studentdao.findById(sid);
    }

    @Override
    public int updateStudent(Student student) {
        return studentdao.updateStudent(student);
    }

    @Override
    public List<Student> findAll2(Student student, int offset, int pageSize) {//带条件查询
        List<Student> students=studentdao.findAll2(student,offset,pageSize);
        return students;
    }

    @Override
    public List<Student> findStudentByName(String name) {
        return studentdao.findStudentByName(name);
    }

    @Override
    public List<Student> findStudentByMajor(String major) {
        return studentdao.findStudentByMajor(major);
    }

    @Override
    public List<Student> findStudentByStatus(String status) {
        return studentdao.findStudentByStatus(status);
    }

    @Override
    public List<Student> findStudentByNum(String studentNum) {
        return studentdao.findStudentByNum(studentNum);
    }


}
